﻿@using GoodMan.Infrastructure.Entities.Entity;
@using GoodMan.Tool.Configration;
@{
    Layout = "/Views/Shared/_Main.cshtml";

    List<ProductCategory> ProductCategoryList = ViewBag.ProductCategory;
    ItemListBox<Product> PackagesProductlist = ViewBag.PackagesProducts;
}
@section head{
    <link rel="stylesheet" href="/Scripts/nivo-slider/themes/default/default.css" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="/Scripts/nivo-slider/nivo-slider.css" />
    <link rel="stylesheet" type="text/css" href="/Scripts/carouFredSel/jquery.carouFredSel-6.0.5-packed.css" />
    <script type="text/javascript" src="/Scripts/carouFredSel/helper-plugins/jquery.ba-throttle-debounce.min.js"></script>
    <script type="text/javascript" src="/Scripts/carouFredSel/helper-plugins/jquery.mousewheel.min.js"></script>
    <script type="text/javascript" src="/Scripts/carouFredSel/helper-plugins/jquery.touchSwipe.min.js"></script>
    <script type="text/javascript" src="/Scripts/carouFredSel/jquery.carouFredSel-6.1.0-packed.js"></script>
}
<!--#主菜单-->
<div class="row">
    <div class="span3">
        <!--左侧导航列表-->
        <ul class="nav nav-tabs nav-stacked">
        @{
            int rowcount=12;
            if (ProductCategoryList != null && ProductCategoryList.Any())
            {
                rowcount = rowcount - ProductCategoryList.Count;
                int m=0;
                foreach (var item in ProductCategoryList)
                {
                    if(m<12)
                    { 
                    if (item.IsActive == true)
                    {
                        m++;
                    <li class="dropdown-submenu dropdown-submenu-x"><a href="/shop/GeneralProductArea?category=@item.Id" target="_blank">@item.CategoryName</a>
                    @{
                        if (item.productCategorys != null && item.productCategorys.Any())
                        {
                            var list = item.productCategorys.Where(c => c.IsActive == true).ToList();
                            if (list != null && list.Count > 0)
                            {
                                int count = list.Count;
                                int j = 0;
                                @:<ul class="dropdown-menu dropdown-menu-sub">
                                foreach (var subItem in item.productCategorys)
                                {
                                    if (subItem.IsActive == true)
                                    {
                                        string url = "../shop/GeneralProductArea?category=" + item.Id + "&subCategory=" + subItem.Id;
                                        if (j % 6 == 0)
                                        {
                                         @:<li>
                                           @:<div class="row-fluid"><div class="span1"></div>
                                                @:<div class="span10 text-normal">
                                        }
                                        @:|<a href="@url" target="_blank">@subItem.CategoryName</a>
                                        
                                        if (j % 6 == 5 || (j + 1) == count)
                                        {
                                                @:|</div>
                                               @:</div>
                                            @: </li>
                                        }
                                        j++;

                                    }
                                }
                                  @:</ul>
                            }
                        }
                    }
                    
                    </li>
                    }
                    }
                    else
                    {
                        break;
                    }
                    
                }
            }
            for(int i=0;i<rowcount;i++)
            {
            <li class="dropdown-submenu dropdown-submenu-x"><a>&nbsp;</a>
            
            </li>
            }
            
        } 
        </ul>
        <!--#左侧导航列表-->
    </div>
    <div class="span9">
        <div class="carousel-container">
            <!--轮播-->
        <div class="courses-box">
            <div class="image_carousel" style="width:700px;">
                <ul id="courses-slider">
                    @{
                        var scroll = SiteResource.Block.FirstOrDefault(c => c.Key == "1");
                      foreach(var item in scroll.Items)
                      {
                     <li><a href="@item.href"><img src="@item.img"/></a>
                        <div class="p-name">
                            <a href="@item.href" title="@item.alt">@item.product</a><br/>
                            <span class="yen">&yen;</span><span class="price">@item.price</span>
                        </div>
                    </li>
                      }}
                </ul>
                <div class="clear"></div>
                <div class="pagination" id="foo2_pag" style="text-align: right;"></div>
            </div>
        </div>
        <div class="clear"></div>
            <!--#轮播-->
        </div>
        <div class="title-line title-line-red"><a class="pull-right" href="/shop/PrductArea?code=general&type=3">更多特卖</a>
    <h4>
        限时特卖</h4>
</div>
        <div class="row-fluid" id="fiveSpecial">
            <!--每日特价区-->
            <!--每日特价区图片大小:150x100-->
            
            <!--#每日特价区-->
        </div>
    </div>
</div>
<!--//////////////////////////////////////////////////////////////////////////////////-->
<div class="title-line title-line-red">
<a class="pull-right" href="/shop/PrductArea?code=general&type=2">更多推荐</a>
    <h4>
        特别推荐</h4>
</div>
<div class="row-fluid" id="fiveRecommended">
    <!--特别推荐-->
    
    <!--#特别推荐-->
</div>
<div class="row">
    <!--AD-->
    <!--AD:960x60-->
    <div class="span12 text-center ad-banner">
        @{SiteResource.BlockItem adv1 = SiteResource.Block.FirstOrDefault(c => c.Key == "2").Items.FirstOrDefault();}
        @if (adv1 != null)
        {
            if (String.IsNullOrEmpty(adv1.href))
            {
                <a>
                <img src="@adv1.img" alt="@adv1.alt" /></a> 
            }
            else
            {
                <a href="@adv1.href">
                <img src="@adv1.img" alt="@adv1.alt" /></a> 
            }
        }
        
    </div>
    <!--#AD-->
</div>
<!--//////////////////////////////////////////////////////////////////////////////////-->
<div class="title-line title-line-red">
    <a class="pull-right" href="/shop/PrductArea?code=groupbuy">更多团购</a><h4>
        团购区</h4>
</div>
<div class="row-fluid" id="fiveGroupBuy">
    <!--团购区-->
   
    <!--#团购区-->
</div>
<div class="row">
    <!--AD-->
    <!--AD:960x60-->
    <div class="span12 text-center ad-banner">
    @{SiteResource.BlockItem adv2 = SiteResource.Block.FirstOrDefault(c => c.Key == "3").Items.FirstOrDefault();}
        @if (adv1 != null)
        {
            if (String.IsNullOrEmpty(adv2.href))
            {
            <a>
            <img src="@adv2.img" alt="@adv2.alt" /></a> 
            }
            else
            { 
            <a href="@adv2.href">
            <img src="@adv2.img" alt="@adv2.alt" /></a> 
            }
        }
    </div>
    <!--#AD-->
</div>
<div class="row-fluid">
    <div class="span5">
        <div class="title-line title-line-red">
            <a class="pull-right" href="/shop/PrductArea?code=exchange">更多兑换</a><h4>
                积分兑换区</h4>
        </div>
        <div class="row-fluid" id="fiveExchange">
            <!--积分兑换区-->
             
            <!--#积分兑换区-->
        </div>
    </div>
    <div class="span7">
        <div class="title-line title-line-red">
            <a class="pull-right" href="/shop/PackagesProducts">更多套餐</a><h4>
                套餐区</h4>
        </div>
        <div class="row-fluid product-x2">
            <!--套餐区-->
            
            @{
                if (PackagesProductlist != null && PackagesProductlist.Data != null && PackagesProductlist.Data.Count != 0)
                {
                    foreach (var item in PackagesProductlist.Data)
                    {
                <div class="product">
                    <a href="/shop/PackagesProductsDetail?id=@item.Id">
                        <img src="@item.Images" alt="xxx" title="xxx" /></a>
                    <div class="p-name">
                        <a href="/shop/PackagesProductsDetail?id=@item.Id" title="@item.ProductName">@item.ProductName</a><br />
                        价格： <span class="yen">&yen;</span><span class="price">@item.DefaulSalePrice</span>
                    </div>
                </div>
                        }
               
                    }
                    }
            <!--#套餐区-->
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript">
         
        $(document).ready(function (e) {
            $.post("/Home/GetFiveSpecial", null, function (response) {
                $("#fiveSpecial").html(response);
            });
            $.post("/Home/GetFiveRecommended", null, function (response) {
                $("#fiveRecommended").html(response);
            });
            $.post("/Home/GetFiveGroupBuy", null, function (response) {
                $("#fiveGroupBuy").html(response);
            });
            $.post("/Home/GetFiveExchange", null, function (response) {
                $("#fiveExchange").html(response);
            });
        });

        $("#courses-slider").carouFredSel({
            circular: true,
            infinite: true,
            auto: true,
            prev: {
                button: "#foo2_prev",
                key: "left"
            },
            next: {
                button: "#foo2_next",
                key: "right"
            },
            pagination: "#foo2_pag"
        });
    </script>
    
      
}
